<?php
$c = $contents;
$title = $_GET['title'];
$url = $_GET['download'];

$sterm = $_GET['sterm'];
$movieurl = $_GET['movieurl'];
//download=tt01234567&url=base64&title=Something.2012
$lang = lang::get_domain_lang();
$dir = $lang == 'en' ? '' : 'dir="rtl"';
?>
<?if($crawler){?>
<div class="hide">
    <h1>Download <?=$title?> torrent</h1>
    <p><?=$title?> Download movie torrent for dvdrip, HD 720p, 1080p, 3D, subs, subtitles, trailers, and soundtrack ost. torrent telecharger, torrent descargar</p>
    <h2><?=$title?> torrent download </h2>
    <a href="#torrentDownload" title="<?=$title?>  torrent download">
        <?=$title?>  torrent download </a>
    <a href="#watchOnline" title="<?=$title?>  watch online">
        <?=$title?>  watch online </a>
</div>
<?}?>

    <!--background image-->
    <img itemprop="image" src="<?=udnutil::dlurl($c['large_poster'])?>"
            style="background-size: cover;
                    display: block;
                    opacity:0.4;
                    position: absolute;
                    width: 740px;
                    height: 1097px;
                    z-index: -2;
                    -moz-box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);
                    -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, .7);
                    box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);"/>
    <img src="http://<?=$res_server?>/res/img/overlay.png"
            style="background-size: cover;
            display: block;
                    position: absolute;
                    width: 740px;
                    height: 1097px;
                    z-index: -1;
                    -moz-box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);
                    -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, .7);
                    box-shadow: 0px 0px 0px rgba(0, 0, 0, .0);"/>
    <!--end of background image-->

    <div id="tp_mainbar2" style="width: 100%">

        <!-- SECTION for TITLE -->
        <div id="tp_header" style="text-align: center;">
            <h1 itemprop="name" id="tp_title">Downloading <?=$title?> .. <?=ad::get_ad("title");?></h1>

            <!-- MAINBANNER-->
            <?=ad::get_ad("download_page_center");?>

            <div style="margin:0px auto;width:100%;">
                <?if($_GET['g'] == '1' && $url != '#') {?>

                <?if(strpos($url,'magnet') === 0 || strpos($url,'http') === 0){ $url = str_replace(':XX','://',$url); }?>

                <!-- Start of Inbound Now Like to Download Embed Code -->
                <div style="width:100%;text-align: center;">
                    <iframe src="http://convertsocial.com/embeds/like-download/like-download.php?fburl=http://www.facebook.com/udnmovies&rurl=http://<?=$torrent_server.urlencode($url)?>&width=400&height=126&header=1&color=2"
                            scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:400px; height:126px;" allowTransparency="true"></iframe>
                </div>
                <!-- End of Inbound Now Like to Download Embed Code -->
                <?}

                elseif($url == '#') {?>

                    <p>Sorry we could not find <?=$title?>. Do not worry, you may
                        <a href="https://cinaplay.com/pages/flowplayer?a_aid=51a4de24b6608&a_bid=72491354&chan=&pubid=&sid=&clickid=&subid=&g=030e5e6a3ad66c0c7f1c826a4beeef4a&&theme=lightgrey_no_banner">
                            find it by checking the daily updated, live streaming HD movies library!
                        </a>
                    </p>
                    <!--

                    <script type="text/javascript">
                        function isValidEmailAddress(emailAddress) {
                            var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
                            return pattern.test(emailAddress);
                        };

                        jQuery(document).ready(function($) {
    						setTimeout(function() {
                                $('form').show();

                            }, 5000);

                            // this is the id of the submit button
                            $('#email').on('keypress', function(e){
                                var code = (e.keyCode ? e.keyCode : e.which);
                                if(code == 13) { //Enter keycode
                                    //Do something
                                    $('#submitButtonId').click();
                                }

                            });
                            $("#submitButtonId").click(function() {
                                if(isValidEmailAddress($('#email').val()))
                                {
                                    $("#requestForm").hide();
                                    $("#done").show();
                                    var url = "http://udnweb.com/irequest"; // the script where you handle the form input.
                                    $.ajax({
                                        type: "POST",
                                        url: url,
                                        data: $("#requestForm").serialize() // serializes the form's elements.

                                        /*
                                        //cross domain issue
                                        ,success: function(data)
                                        {
                                            $("#wait").hide();
                                            $("#done").show();
                                            //alert(data); // show response from the php script.
                                        }
                                        */
                                    });
                                }
                                else
                                    alert('Invalid email!');

                                return false; // avoid to execute the actual submit of the form.
                            });
                        });
                    </script>

                    <form <?=$dir?> id="requestForm" style="display: none">

                        <p <?=$dir?>><?=lang::get('sorry_1')?> <?= $sterm?>, <?=lang::get('sorry_2')?></p>
                        <?=lang::get('email')?> <input id="email" type="text" name="email" /><br >
                        <input type="hidden" name="page_url" value="<?=$movieurl?>" /><br />
                        <input type="hidden" name="search_term" value="<?=$sterm?>" /><br />

                        <?=lang::get('format')?>:
                        <select name="tab">
                            <option value="dvdrip">DVDRip</option>
                            <option value="720p">HD 720p</option>
                            <option value="1080p">Full HD 1080p</option>
                        </select>
                        <button id="submitButtonId">Submit</button>
                        <div style="text-align: center">
                            <?= ad::get_ad('small_banner_1');?>
                            <?= ad::get_ad('small_banner_2');?>
                            <?= ad::get_ad('small_banner_3');?>
                            <?= ad::get_ad('small_banner_4');?>
                        </div>
                    </form>
                    <span id="done" style="display: none">Your request was submitted successfully,<br /> We will send you an email once it becomes available.</span>
-->

                    <?}
                else {?>
                    <?if(strpos($url,'magnet') === 0 || strpos($url,'http') === 0){?>
                        <a onclick="$('#ads').show();return true;" href="<?=str_replace(':XX','://',$url)?>">Download <?=$title?></a>
                    <?} else {?>
                        <a onclick="$('#ads').show();return true;" href="http://<?=$torrent_server.$url?>">Download <?=$title?></a>
                    <?}?>
                    <div style="width:100%;text-align: center;" class="fb-like" data-href="http://facebook.com/udnmovies" data-send="true" data-layout="button_count" data-width="214" data-show-faces="false" data-font="verdana" data-colorscheme="dark"></div>

                    <?}?>
            </div>

       </div>



        <div id="ads" style="text-align: center; display: none;">
            <?= ad::get_ad('small_banner_1');?>
            <?= ad::get_ad('small_banner_2');?>
            <?= ad::get_ad('small_banner_3');?>
            <?= ad::get_ad('small_banner_4');?>
        </div>

        <!-- SECTION for SIMILAR -->
        <?if($c['similar']){?>
        <h3 id="tp_section_similar">People also Downloaded</h3>
        <div id="tp_similar">
            <ul>
                <?foreach($c['similar'] as $m){?>
                    <li>
                        <a itemscope="1" itemtype="http://schema.org/Movie"
                           title="<?=$m['title']?>"
                           href="?movieid=<?=$m['id']?>&amp;title=<?=str_replace(' ', '-', $m['title'])?>-Torrent-Download-dvdrip-brrip-720p-1080p-subs-bluray-3d">
                            <img itemprop="image" alt="" class="lazy" src="http://<?=$res_server?>/res/img/movie.png" data-original="<?= $m['poster'] != 'http://'.$dl_server.'/dl/' ? udnutil::dlurl($m['poster']):'http://'.$dl_server.'/res/img/no_poster.jpg'?>"/>
                        </a>
                    </li>
                <?}?>
            </ul>
            <div class="tp_clear"></div>
        </div>
        <?}?>


    </div>



<!--facebook-->
<div id="fb-root"></div>
<script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>